package com.hqd.jjvm.classformat.attributeinfo;

import com.hqd.jjvm.classformat.ClassFile;
import com.hqd.jjvm.util.HexStrTransformUtil;
import lombok.Getter;
import lombok.NoArgsConstructor;

import java.util.List;

@Getter
@NoArgsConstructor
public class RuntimeInvisibleParameterAnnotations extends ParameterAnnotationAttributeInfo {
	private Integer numParameters;
	List<ParameterAnnotations> parameterAnnotationList;

	public RuntimeInvisibleParameterAnnotations(Integer attributeNameIndex, Integer attributeLength) {
		super(attributeNameIndex, attributeLength);
	}

	@Override
	protected RuntimeInvisibleParameterAnnotations newAttributeInfo(Integer attributeNameIndex, Integer attributeLength, ClassFile classFile) {
		this.numParameters = HexStrTransformUtil.parseHexToInt(classFile.readU1());
		this.parameterAnnotationList = parseParameterAnnotations(classFile, numParameters);
		return this;
	}
}
